#coding=utf-8
from BeautifulSoup import BeautifulSoup
import re
html = """
<html>
<body>
 <table>
 <td><input name="input1">Row 1 cell 1
 <tr><td>Row 2 cell 1
 <td>Row 2 cell 2<br>This</br> sure is a long cell
 </table>
 <img src="abc" name="name1"/>
 <img src="cbd" name="name2"/>
 <img src="efj" name="name3"/>
 <div class='prodline'><div class='prodsingle'>
 <div class='singletu' align=center>
 <a href='/Product/ProductInfo_01_1062494.html' target=_blank>
 <img src='http://img.redbaby.com.cn/UpFile/Images/Product/Small/2008_6_4_16_50_22_9136.jpg' onload='Reset_ImgSize(this,150,150);' title='ZA保湿平衡水200ml'>
 </a>
 </div>
 <div class='singlename'>
 <a href='/Product/ProductInfo_01_1062494.html' target='_blank'>ZA保湿平衡水200ml</a>
 </div>
 <div class='singleprice'>市 场 价：<STRIKE>￥78.00</STRIKE><br>&nbsp;红孩子价：<font color=red>￥</font><b>75.00</b></div>
 <div class='singlecart'><a href="javascript:AddCats('01','1062494','1');"  title='购买'>
 <img src='/images/productimg/goumai.gif'></a><a href="javascript:AddFavorite('01','1062494');" title='收藏'>
 <img src='/images/productimg/shoucang.gif'></a></div></div><div class='prodsingle'>
 <div class='singletu' align=center>
 <a href='/Product/ProductInfo_01_1062495.html' target=_blank>
 <img src='http://img.redbaby.com.cn/UpFile/Images/Product/Small/2008_6_4_16_50_23_4294.jpg' onload='Reset_ImgSize(this,150,150);' title='ZA保湿化妆水150ml'>
 </a></div><div class='singlename'><a href='/Product/ProductInfo_01_1062495.html' target='_blank'>ZA保湿化妆水150ml</a>
 </div><div class='singleprice'>市 场 价：<STRIKE>￥78.00</STRIKE><br>&nbsp;红孩子价：<font color=red>￥</font><b>73.00</b></div>
 <div class='singlecart'><a href="javascript:AddCats('01','1062495','1');"  title='购买'>
 <img src='/images/productimg/goumai.gif'></a><a href="javascript:AddFavorite('01','1062495');" title='收藏'>
 <img src='/images/productimg/shoucang.gif'></a></div></div><div class='prodsingle'>
 <div class='singletu' align=center><a href='/Product/ProductInfo_01_1062496.html' target=_blank>
 <img src='http://img.redbaby.com.cn/UpFile/Images/Product/Small/2008_6_4_16_50_23_9452.jpg' onload='Reset_ImgSize(this,150,150);' title='ZA紧肤化妆水150ml'>
 </a></div><div class='singlename'>
 <a href='/Product/ProductInfo_01_1062496.html' target='_blank'>ZA紧肤化妆水150ml</a></div><div class='singleprice'>市 场 价：<STRIKE>￥73.00</STRIKE>
 <br>&nbsp;abcddfsdf<font color=red>￥</font><b>75.00</b></div>
 <div class='singlecart'><a href="javascript:AddCats('01','1062496','1');"  title='购买'>
 <img src='/images/productimg/goumai.gif'></a><a href="javascript:AddFavorite('01','1062496');" title='收藏'>
 <img src='/images/productimg/shoucang.gif'></a></div></div></div>
</body> 
</html>"""
soup = BeautifulSoup(html)

#markets = soup.findAll(text=u'市 场 价：')
#for market in markets:
#    print market.findNext('strike').next

#print paraText

#print soup.prettify()

ss = soup.findAll(name='div',attrs={"class":"prodsingle"})

for s in ss:
    #print s;
    div = BeautifulSoup(s.prettify());
    namediv= div.find(name='div',attrs={"class":"singlename"});
    pricediv= div.find(name='div',attrs={"class":"singleprice"});
    imagediv= (div.find(name='div',attrs={"class":"singletu"})).find(name='img')["src"];
    marketprice = pricediv.find(name='strike');
    redbabyprice = pricediv.find(name='b')
    print redbabyprice.next;
    print marketprice.next;
    print namediv.find(name='a').next;
    
    
